package com.ctbri.enums;

import static com.ctbri.enums.Signal.*;

public class Ex1_TrafficLight {
	
	Signal color = RED;
	
	public void change() {
		switch(color){
		case RED:
			color = GREEN;
			break;
		case GREEN:
			color = YELLOW;
			break;
		case YELLOW:
			color = RED;
			break;
		}
	}
	
	public String toString() {
		return "The traffice light is " + color;
	}
	
	public static void main(String[] args) {
		Ex1_TrafficLight t = new Ex1_TrafficLight();
		for(int i = 0; i < 7; i++){
			System.out.println(t);
			t.change();
		}
	}
}
